<?php
namespace Yd\Controller;
use Common\Controller\HomebaseController;

class YddatelimitController extends HomebaseController{
	
	protected $_model;
	
	function _initialize() {
		parent::_initialize();
		$this->_model =D("Yddatelimit");
	}
	
	public function index(){
		$str='';
		if (IS_POST) {
			$yddates = I('post.yddates');
			$result = $this->_model->fbyd($yddates);
			if ($result == 1) {
				$str = '发布预订成功！';
			}else{
				$str = '发布预订失败！';
			}
		}
		$old_date = $this->get_old_date();
		$this->assign("old_date", $old_date);	//当前预订状态
		$this->assign("str", $str);	//提交状态
		$this->Display();
	}


	//读取老的预订日期
	public function get_old_date(){
		$where['id'] = 1;
		$result = $this->_model->where($where)->getField('end-date');
		return $result;
	}
}
